<?php

class Adept_Template_Component_TextNode extends Adept_Template_Component_Node 
{
    
    protected $text;
    
    /**
     * @param Adept_Template_Writer_Php $writer
     */
    public function generate($writer) 
    {
        $var = $writer->generateVar();
    	$writer->writePhp("{$var} = new Adept_Component_Text();\n");
    	
    	$writer->writePhp($this->parent->getElementRefCode());
    	$writer->writePhp("->addChild({$var});\n");
    	
    	$writer->writePhp("{$var}->setText(");
    	$writer->writePhpLiteral($this->getText());
    	$writer->writePhp(");\n");
    	$writer->writePhp("{$var}->setId(");
    	$writer->writePhpLiteral($this->getNodeId());
    	$writer->writePhp(");\n");
    }	
    
    public function getText() 
    {
        return $this->text;
    }
    
    public function setText($text) 
    {
        $this->text = $text;
    }
    
}
